#include <iostream>
#include <algorithm>

using namespace std;

typedef long long LL;

const int N = 1e5 + 10;

int a[N], b[N];

int n, m;

int main()
{
	cin >> n >> m;
	
	for (int i = 0; i < n; i ++ ) cin >> a[i];
	for (int i = 0; i < m; i ++ ) cin >> b[i];
	
	sort(a, a + n);
	sort(b, b + m);
	
	int res = 0;
	
	int i = 0, j = 0;
	
	for (i = 0, j = 0; j < n && i < m; i ++ , j ++ )
	{
		while (j < n && b[i] > a[j]) j ++ ;
		if (b[i] <= a[j]) res ++ ;
		
		
	}
	
	cout << res << endl;
	
	return 0;
}